// routes/workflowRoutes.js
const express = require('express');
const router = express.Router();
const WorkflowController = require('../controllers/workflowController');
const authMiddleware = require('../middleware/auth');

// 所有路由都需要认证
router.use(authMiddleware);

router.post('/', WorkflowController.createWorkflow);
router.get('/', WorkflowController.getUserWorkflows);
router.get('/:id', WorkflowController.getWorkflow);
router.put('/:id', WorkflowController.updateWorkflow);
router.delete('/:id', WorkflowController.deleteWorkflow);
router.post('/:id/execute', WorkflowController.executeWorkflow);
router.get('/:id/executions', WorkflowController.getExecutionHistory);

module.exports = router;